#ifndef FORMLEASES_H
#define FORMLEASES_H

#include <QWidget>
#include <QItemSelectionModel>
#include "dbmscontainer.h"
#include "modelcontainer.h"

namespace Ui {
    class FormLeases;
}

class FormLeases : public QWidget, public DbmsContainer
{
    Q_OBJECT

    LeasesModel *mp_l_model;
    QItemSelectionModel *mp_l_selection_model;
    QVariant mqv_current_lease_index;

public:
    explicit FormLeases(QWidget *parent = 0);
    ~FormLeases();

    void update_model(const LeasesModel::Filter *p_filter = NULL);
    void set_dbms(HousingDBMS *p_dbms);
    void restore_selection();
    void resize_table();
protected:
    void resizeEvent(QResizeEvent *);
private:
    Ui::FormLeases *ui;
private slots:
    void new_lease();
    void del_lease();
    void edit_lease(const QModelIndex &mod_index);
    void selection_changed(const QModelIndex & mod_index);
    void on_show_filter_clicked(bool checked);
    void update_filter();
    void reset_filter();
    void on_chbox_use_date_filter_clicked(bool checked);
    void stop_lease();
    void export_lease();

};

#endif // FORMLEASES_H
